/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bit.entidade;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author marcelo
 */
@Entity
@Table(name = "aplicativo")
@NamedQueries({@NamedQuery(name = "Aplicativo.findAll", query = "SELECT a FROM Aplicativo a"), @NamedQuery(name = "Aplicativo.findById", query = "SELECT a FROM Aplicativo a WHERE a.id = :id"), @NamedQuery(name = "Aplicativo.findByNome", query = "SELECT a FROM Aplicativo a WHERE a.nome = :nome")})
public class Aplicativo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @JoinColumn(name = "id_maquina", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Maquina idMaquina;

    public Aplicativo() {
    }

    public Aplicativo(Long id) {
        this.id = id;
    }

    public Aplicativo(Long id, String nome) {
        this.id = id;
        this.nome = nome;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Maquina getIdMaquina() {
        return idMaquina;
    }

    public void setIdMaquina(Maquina idMaquina) {
        this.idMaquina = idMaquina;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aplicativo)) {
            return false;
        }
        Aplicativo other = (Aplicativo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bit.entidade.Aplicativo[id=" + id + "]";
    }

}
